package com.atguigu.springcloud.alibaba.service;

import com.atguigu.springcloud.entities.CommonResult;
import com.atguigu.springcloud.entities.Payment;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @auther zzyy
 * @create 2020-02-14 18:54
 */
@Component
public class PaymentFallbackFactoryService implements FallbackFactory<PaymentService>
{
    @Override
    public PaymentService create(Throwable throwable)
    {
        return new PaymentService()
        {
            @Override
            public CommonResult<Payment> paymentSQL(Long id)
            {
                return new CommonResult<>(444,"没有该流水信息/服务提供者宕机,服务调用失败降级处理。异常信息："+"\t"+throwable.getMessage(),new Payment(id, "errorSerial......"));
            }
        };
    }
}
